package com.kws.tool.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * @author : zhangbenting
 * @date : 2024/11/11 19:02
 * @Version: 1.0
 */
@Data
@NoArgsConstructor
public class InvoiceRequest {

    @ApiModelProperty("商户号")
    private String svcId;

    @ApiModelProperty("接口ID")
    private String svcApi = "up.fpsd.fapiao.trans.issue";

    @ApiModelProperty("签名方法")
    private String signType;

    @ApiModelProperty("请求时间戳")
    private String timestamp;

    @ApiModelProperty("版本号")
    private String version;

    @ApiModelProperty("签名")
    private String sign;

    @ApiModelProperty("业务请求参数")
    private BizContent bizContent;

    /**
     * 转换为 Map，用于签名生成
     */
    public Map<String, String> toMap() {
        Map<String, String> paramMap = new HashMap<>();
        paramMap.put("svcId", svcId);
        paramMap.put("svcApi", svcApi);
        paramMap.put("signType", signType);
        paramMap.put("timestamp", timestamp);
        paramMap.put("version", version);
        paramMap.put("bizContent", bizContent.toString());  // 将 bizContent 转为 JSON 字符串
        return paramMap;
    }
}
